
#ifndef __H_SYMPHONY_ROOM
#define __H_SYMPHONY_ROOM

#include <list>
#include <string>
#include "object.h"
#include "symphony.h"
#include "terrain.h"

// Room flags...
#define RFLAG_UNDEFINED 0
#define RFLAG_NOMAP     A
#define RFLAG_NOGATE    B

// Message targets...
#define TO_CREATURE 0
#define TO_VICT     1
#define TO_NOTVICT  2
#define TO_ROOM     3
#define TO_ALL      4

class Area;
class Creature;
class Exit;



class Room {
  private:
    unsigned long           _ID;
    Area*                   _area;
    unsigned long           _vnum;
    std::string             _name;
    std::string             _description;
    std::string             _smell;
    std::string             _sound;
    Terrain*                _terrain;
    unsigned long           _flags;
    Exit*                   _exits[6];
    std::list<Creature*>    _creatures;
    std::list<Object*>      _objects;

  public:
    Room( const unsigned long& vnum, Area* area );
    Room( Area* area, ROW& row );
    ~Room( void );

    // Public accessor methods...
    void                          ID( const unsigned long& ID )                                     { _ID = ID; }
    unsigned long                 ID( void ) const                                                  { return _ID; }
    void                          area( Area* area )                                                { _area = area; }
    Area*                         area( void )                                                      { return _area; }
    void                          vnum( const unsigned long& vnum )                                 { _vnum = vnum; }
    unsigned long                 vnum( void ) const                                                { return _vnum; }
    void                          name( const std::string& name )                                   { _name = name; }
    std::string                   name( void ) const                                                { return _name; }
    void                          description( const std::string& description )                     { _description = description; }
    std::string                   description( void ) const                                         { return _description; }
    std::string*                  descriptionp( void )                                              { return &_description; } // have to expose this for the text editor
    void                          smell( const std::string& smell )                                 { _smell = smell; }
    std::string                   smell( void ) const                                               { return _smell; }
    void                          sound( const std::string& sound )                                 { _sound = sound; }
    std::string                   sound( void ) const                                               { return _sound; }
    void                          terrain( Terrain* terrain )                                       { _terrain = terrain; }
    Terrain*                      terrain( void )                                                   { return _terrain; }
    void                          flags( const unsigned long& flags )                               { _flags = flags; }
    unsigned long                 flags( void ) const                                               { return _flags; }
    void                          flag( const unsigned long& flag, const bool& value )              { flags( value ? (flags()|flag) : (flags()&(~flag)) ); }
    bool                          flag( const unsigned long& flag )                                 { return ( (flags()&flag) == flag ); }
    void                          exit( const unsigned short& direction, Exit* exit );
    Exit*                         exit( const unsigned short& direction );
    Exit*                         exit( const std::string& direction );
    std::list<Creature*>&         creatures( void )                                                 { return _creatures; }
    const std::list<Creature*>&   creatures( void ) const                                           { return _creatures; }
    std::list<Object*>&           objects( void )                                                   { return _objects; }
    const std::list<Object*>&     objects( void ) const                                             { return _objects; }

    // General methods...
    bool                          loadExits( void );
    void                          add( Creature* creature )                                                       { creatures().push_back( creature ); }
    void                          remove( Creature* creature )                                                    { creatures().remove( creature ); }
    void                          add( Object* object )                                                           { objects().push_back( object ); }
    void                          remove( Object* object )                                                        { objects().remove( object ); }
    Object*                       findObject( const std::string& name );
    Creature*                     findCreature( const std::string& name );
    void                          send( const char* format, Creature* creature = NULL, void* arg1 = NULL,
                                        void* arg2 = NULL, const unsigned long& target = TO_ROOM );
    void                          send_cond( const char* format, Creature* creature = NULL, void* arg1 = NULL,
                                        void* arg2 = NULL, const unsigned long& target = TO_ROOM );
    void                          save( void );
    bool                          destroy( void );
    bool                          clear( void );
    std::string                   listFlags( void );

    // Statics...
    static const char*    getFlagName( const unsigned long& flag );
    static unsigned long  getFlagType( const std::string& flag );

};



#endif // #ifndef __H_SYMPHONY_ROOM

